using System;
using System.Collections.Generic;
using System.Data;
using System.Text;

namespace WOWEquipOptimizer
{
    /// <summary>
    /// pretty much self explaining, base functions for the specific character metaclass
    /// </summary>
    abstract class MeleeDD : Character
    {
        public MeleeDD()
            : base()
        {
            Buff bom = new Buff("Blessing of Might", new List<Attribute>());
            bom.Attributes.Add(new Attribute(AttributeName.AttackPower, 220));
            Buffs.Add(bom);
            Buff relassault = new Buff("Flask of Relentless Assault", new List<Attribute>());
            relassault.Attributes.Add(new Attribute(AttributeName.AttackPower, 120));
            Buffs.Add(relassault);
            Buff majagi = new Buff("Elixir of Major Agility", new List<Attribute>());
            majagi.Attributes.Add(new Attribute(AttributeName.Agility, 35));
            majagi.Attributes.Add(new Attribute(AttributeName.CritRating, 20));
            majagi.Enabled = false;
            Buffs.Add(majagi);
            Buff battleshout = new Buff("Battleshout", new List<Attribute>());
            battleshout.Attributes.Add(new Attribute(AttributeName.AttackPower, 385));
            Buffs.Add(battleshout);
            Buff lotp = new Buff("Leader of the pack", new List<Attribute>());
            lotp.Attributes.Add(new Attribute(AttributeName.CritRating, (int) (5 * CritRating)));
            Buffs.Add(lotp);
            Buff roastcleft = new Buff("Roasted Clefthoof", new List<Attribute>());
            roastcleft.Attributes.Add(new Attribute(AttributeName.Strength, 20));
            roastcleft.Attributes.Add(new Attribute(AttributeName.Spirit, 20));
            Buffs.Add(roastcleft);
            Buff mudfish = new Buff("Grilled Mudfish", new List<Attribute>());
            mudfish.Attributes.Add(new Attribute(AttributeName.Agility, 20));
            mudfish.Attributes.Add(new Attribute(AttributeName.Spirit, 20));
            mudfish.Enabled = false;
            Buffs.Add(mudfish);
        }
        public override List<Item> filterEquip(List<Item> input)
        {
            input = base.filterEquip(input);
            List<Item> retval = new List<Item>();
            foreach (Item item in input)
            {
                bool bad = false;
                foreach (Attribute attr in item.Attributes)
                {
                    switch (attr.Type)
                    {
                        case AttributeName.SpellDamage:
                        case AttributeName.HitSpellRating:
                        case AttributeName.CritSpellRating:
                        case AttributeName.Healing:
                            {
                                bad = true;
                                break;
                            }
                        default:
                            break;
                    }
                }
                if (!bad)
                {
                    retval.Add(item);
                }
            }
            return retval;
        }
        public override void evaluateItem(Item item, int slot)
        {
            base.evaluateItem(item, slot);
            if (item.GetType() == typeof(Weapon) && (slot == (int)Enum.Parse(typeof(SlotName), "MainHand", true)))
            {
                m_Equip[AttributeName.MHWDPS] = ((Weapon)item).DPS;
                m_Equip[AttributeName.MHWS] = ((Weapon)item).Speed;
            }
            else if (item.GetType() == typeof(Weapon) && (slot == (int)Enum.Parse(typeof(SlotName), "OffHand", true)))
            {
                m_Equip[AttributeName.OHWDPS] = ((Weapon)item).DPS;
                m_Equip[AttributeName.OHWS] = ((Weapon)item).Speed;
            }
            if (item.WeaponSkills.Count > 0)
            {
                m_WeaponSkills.AddRange(item.WeaponSkills);
            }
        }
        public override string[] getAttributes()
        {
            return new string[] { "DPS", "DPS", "WS", "WS", "CritRating", "HitRating", "Attackpower", "HasteRating", "Health" };
        }
        public override int getAttributesStart()
        {
            return 4;
        }
        public override string targetValue()
        {
            return "DPS";
        }
    }
}
